package com.twu.biblioteca.option;

import com.twu.biblioteca.service.BookService;
import com.twu.biblioteca.core.Option;
import com.twu.biblioteca.util.Cli;

public class ReserveBookOption extends Option {
    private BookService bookService;

    public ReserveBookOption(BookService bookService, Cli cli) {
        super("Reserve Book", cli);
        this.bookService = bookService;
    }

    @Override
    public void execute() {
        int bookIndex = cli.promptInt("please select a book");
        if (bookService.reserveBook(bookIndex)) {
            cli.output("Thank You! Enjoy the book.");
        } else {
            cli.output("Sorry we don't have that book yet.");
        }
    }
}
